package com.niodata.md.rdb.crawler;

/**
 * table retrieval options.
 */
public class TableRetrievalOptions {

  private  String namePattern = ".*";

  private  String[] nameExclusions = new String[]{};

  private boolean withDataInfo = true;

  private boolean withColumnInfo = true;

  private String schemaPattern = null;

  public String getNamePattern() {
    return namePattern;
  }

  public String[] getNameExclusions() {
    return nameExclusions;
  }

  public boolean isWithDataInfo() {
    return withDataInfo;
  }

  public boolean isWithColumnInfo() {
    return withColumnInfo;
  }

  public String getSchemaPattern() {
    return schemaPattern;
  }

  /**
   * set whether to retrieve data info.
   *
   * @param withDataInfo whether to retrieve data info
   * @return this
   */
  public TableRetrievalOptions withDataInfo(boolean withDataInfo) {
    this.withDataInfo = withDataInfo;
    return this;
  }

  /**
   * set name exclusions.
   *
   * @param nameExclusions name exclusions
   * @return this
   */
  public TableRetrievalOptions withNameExclusions(String[] nameExclusions) {
    this.nameExclusions = nameExclusions;
    return this;
  }

  /**
   * set name pattern.
   *
   * @param namePattern name pattern
   * @return this
   */
  public TableRetrievalOptions withNamePattern(String namePattern) {
    this.namePattern = namePattern;
    return this;
  }

  /**
   * Constructor.
   */
  public TableRetrievalOptions() {
  }

  /**
   * retrieval options, with data and column info.
   *
   * @return table retrieval options
   */
  public static TableRetrievalOptions retrievalWithDataAndColumnInfo() {
    return new TableRetrievalOptions();
  }

  /**
   * retrieval options, without data info.
   *
   * @return table retrieval options
   */
  public static TableRetrievalOptions retrievalWithoutDataInfo() {
    TableRetrievalOptions options = new TableRetrievalOptions();
    options.withDataInfo = false;
    return options;
  }

  /**
   * retrieval options, without data and column info.
   *
   * @return table retrieval options
   */
  public static TableRetrievalOptions retrievalWithoutDataAndColumnInfo() {
    TableRetrievalOptions options = new TableRetrievalOptions();
    options.withDataInfo = false;
    options.withColumnInfo = false;
    return options;
  }

  /**
   * set schema.
   *
   * @param schemaPattern schemaPattern
   * @return this
   */
  public TableRetrievalOptions withSchemaPattern(String schemaPattern) {
    this.schemaPattern = schemaPattern;
    return this;
  }

}
